package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.PaOrderItemMapper;
import com.ruoyi.system.domain.PaOrderItem;
import com.ruoyi.system.service.IPaOrderItemService;

/**
 * 订单项的产品Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-07-03
 */
@Service
public class PaOrderItemServiceImpl implements IPaOrderItemService 
{
    @Autowired
    private PaOrderItemMapper paOrderItemMapper;

    /**
     * 查询订单项的产品
     * 
     * @param orderItemId 订单项的产品主键
     * @return 订单项的产品
     */
    @Override
    public PaOrderItem selectPaOrderItemByOrderItemId(Long orderItemId)
    {
        return paOrderItemMapper.selectPaOrderItemByOrderItemId(orderItemId);
    }

    /**
     * 查询订单项的产品列表
     * 
     * @param paOrderItem 订单项的产品
     * @return 订单项的产品
     */
    @Override
    public List<PaOrderItem> selectPaOrderItemList(PaOrderItem paOrderItem)
    {
        return paOrderItemMapper.selectPaOrderItemList(paOrderItem);
    }

    /**
     * 新增订单项的产品
     * 
     * @param paOrderItem 订单项的产品
     * @return 结果
     */
    @Override
    public int insertPaOrderItem(PaOrderItem paOrderItem)
    {
        paOrderItem.setCreateTime(DateUtils.getNowDate());
        return paOrderItemMapper.insertPaOrderItem(paOrderItem);
    }

    /**
     * 修改订单项的产品
     * 
     * @param paOrderItem 订单项的产品
     * @return 结果
     */
    @Override
    public int updatePaOrderItem(PaOrderItem paOrderItem)
    {
        paOrderItem.setUpdateTime(DateUtils.getNowDate());
        return paOrderItemMapper.updatePaOrderItem(paOrderItem);
    }

    /**
     * 批量删除订单项的产品
     * 
     * @param orderItemIds 需要删除的订单项的产品主键
     * @return 结果
     */
    @Override
    public int deletePaOrderItemByOrderItemIds(Long[] orderItemIds)
    {
        return paOrderItemMapper.deletePaOrderItemByOrderItemIds(orderItemIds);
    }

    /**
     * 删除订单项的产品信息
     * 
     * @param orderItemId 订单项的产品主键
     * @return 结果
     */
    @Override
    public int deletePaOrderItemByOrderItemId(Long orderItemId)
    {
        return paOrderItemMapper.deletePaOrderItemByOrderItemId(orderItemId);
    }
}
